package com.bub.pay.core.manager.user;

import com.bub.pay.core.entity.domain.SysUser;
import com.bub.pay.core.entity.vo.user.GoogleVo;
import com.bub.pay.core.entity.vo.user.LoginVo;
import com.bub.pay.core.entity.vo.user.PasswordVo;
import com.bub.pay.framework.common.base.Cause;
import com.bub.pay.framework.common.entity.model.SessionModel;

import javax.servlet.http.HttpServletRequest;
import java.util.Map;

public interface UserCommonManager {

	SessionModel userLogin(HttpServletRequest httpRequest, LoginVo reqVo);

	SessionModel checkSession(String authToken, String userId, int sysType, String reqIp);

	SessionModel checkSession(String authToken, String userId, int sysType, String reqIp, boolean limitIp);

	void refreshSession(String userId) throws Exception;

	void deleteSession(String userId, HttpServletRequest httpServletRequest);

	boolean bindGoogle(String userId, GoogleVo reqVo) throws Exception;

	Map<String, String> queryBindGoogle(String userId) throws Exception;

	Map<String, String> refreshBindGoogle(String userId) throws Exception;

	boolean removeGoogle(String userId, GoogleVo reqVo) throws Exception;

	boolean changePassword(String userId, PasswordVo reqVo) throws Exception;

	boolean changePayPassword(String userId, PasswordVo reqVo) throws Exception;

	SessionModel getSession(String userId);

	/**
	 * 检测用户是否登陆
	 *
	 * @param userId    用户ID
	 * @param authToken 认证token
	 * @return 是否登陆
	 */
	boolean checkUserLogin(String userId, String authToken);

	/**
	 * 校验支付密码
	 * 
	 * @param payPass
	 * @return
	 */
	boolean checkPayPass(String payPass, Cause... causes);

	/**
	 * 校验谷歌验证码
	 * 
	 * @param googleCode
	 * @return
	 */
	boolean checkGoogle(Long userId,String googleSecret,String googleCode);

	SysUser beforeLoginCheck(SysUser reqVo, boolean limitIp, String reqIp);

	boolean checkGoogle(String googleCode);

	/**
	 * 检验登录密码
	 * @param loginPass
	 * @return
	 */
	boolean checkLoginPassword(String loginPass, Cause... causes);
	
}
